﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RentalDTO;
using RentalIService;
using RentalService.Entities;

namespace RentalService
{
    public class RoleResourceModuleService : IServiceRoleResourceModule
    {
        public List<RoleResourceModuleDTO> selectRole(string id)
        {
            using (var db = new RentalContext())
            {
                var list = (from a in db.RoleResourceModule
                            join b in db.SystemResourceModule
                            on a.ResourceModuleId equals b.Id
                            where a.RoleId == id
                            select new RoleResourceModuleDTO
                            {
                                Id = b.Id,
                                Url=b.Url,
                                ParentId=b.ParentId,
                                UrlName=b.Name,
                                IsDel = b.IsDel
                            }).ToList();
                return list;
            }
        }
    }
}
